<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>



<div class="left_content">
	<div class="title_box">Search</div>
	<div class="border_Box">
        <form method="get" action="Search.do" name="frmSearch">
            <p>
                <label for="productname">Product Name</label>
                <br>
                <input type="text"  name="productname" 
                       <c:if test="${requestScope.productname != null}">
                           value ="${requestScope.productname}"
                       </c:if>
                       style="width:97%">
            </p>
            <p>
                <label for="productcatalog">Product Catalog</label>
                <br>
                <select name="productcatalog" style="width:100%">
                    <option value="-1" selected="selected">--none--</option>
                    <!--Bat Dau Danh Muc-->
                    <c:forEach var="pc" items="${requestScope.listProductCatalog}" >
                        <option 
                            <c:if test="${param.productcatalog != null and param.productcatalog.equals(pc.catalogid.toString())}">
                                    selected='selected'
                            </c:if>
                            value='${pc.catalogid}'> ${pc.catalogname} </option>
                    </c:forEach>
                   
                    <!--Ket Thuc Danh Muc-->
                </select>

                <label for="brand">Brand</label>
                <br>
				<c:forEach var="br" items="${requestScope.listBrand}">
					<input type="checkbox" value="${br.brandname}" name="brand" 
						<c:forEach var="namebrand" items="${requestScope.listbrand }">
							<c:if test="${br.brandname.equals(namebrand) }">
								checked="checked"
							</c:if>
						</c:forEach> 
					/>${br.brandname} <br />
				</c:forEach>
				
				<label for="condition">Condition</label>
                <br>
				<c:forEach var="condition" items="${requestScope.listCondition}">
					<input type="checkbox" value="${condition.conditionname}" name="condition"
						<c:forEach var="namecondition" items="${requestScope.listcondition }">
							<c:if test="${condition.conditionname.equals(namecondition) }">
								checked="checked"
							</c:if>
						</c:forEach> 
					 />${condition.conditionname} <br />
				</c:forEach>
				<label for="rating">Rating</label>
                <br>
				<select name = "rating">
					<option value="-1" selected="selected">--none--</option>
					<c:forEach var="i" begin="1" end="5" >
						
                        <option 
                            <c:if test="${param.rating != null and param.rating == i}">
                                    selected='selected'
                            </c:if>
                            value='${i }'> Over ${i } star </option>
                    </c:forEach>
					
					
				</select>
            </p>

            <p>
                <label for="price">From Price</label>
                <br>
                <input type="text"  name="minprice" 
                       <c:if test="${param.minprice != null}">
                           value ="${param.minprice}"
                       </c:if>
                       
                       style="width:97%">

                <label for="giaBan">To</label>
                <br>
                <input type="text"  name="maxprice" 
                       <c:if test="${param.maxprice != null}">
                           value ="${param.maxprice}"
                       </c:if>
                       
                       style="width:97%">
            </p>
            <input type="submit" value="Search" name="Search">
        </form>
    </div>
    <div class="title_box">Categories</div>
	<ul class="left_menu">
		<!-- Start List Catalog -->
		<c:set var="count" value="0" />
		<c:forEach var="productCatalog"
			items="${requestScope.listProductCatalog}">
			<c:choose>
				<c:when test="${count%2 == 0}">
					<li class="even">
				</c:when>
				<c:otherwise>
					<li class="odd">
				</c:otherwise>
			</c:choose>

			<a href="Products.do?catalogid=${productCatalog.catalogid}">${productCatalog.catalogname}
			</a>
			</li>
			<c:set var="count" value="${count+1}" />
		</c:forEach>
		<!-- End List Catalog -->
	</ul>
 </div>